var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope,$http,$location) {
    $scope.createUser = function () {
        var data = $scope.Player;
        var params = JSON.stringify(data);
        $http.post(httpUrl+"/players/create", params, {
            headers: {
                'Content-Type': 'application/json; charset=UTF-8'
            }
        }).success(function (data, status, headers, config) {
            if (data.status == 200) {
                window.location.href=httpUrl+"/login";
            }
            else
            {
                alert(data.result);
            }
            //location.path('/login');
        }).error(function (data, status, headers, config) {
            alert("error!")
            //location.path('/register.html');
        });
    }
});
